#include "PoligonScreenPosition.h"

PoligonScreenPosition::PoligonScreenPosition(float scale, int n, float rotation, int x, int y)
{
	this->scale = scale;
	this->n = n;
	this->rotation = this->getRadRotation(rotation);
	this->x = x;
	this->y = y;
	
}

// Calculo de vi:
// (x + r * Math.cos(2 * Math.PI * i / n), y + r * Math.sin(2 * Math.PI * i / n))

float PoligonScreenPosition::getRadRotation(float rotationAngle) {
	return float((rotationAngle / 180.0)*Constants::PI);
}

float PoligonScreenPosition::calculateX(int v) {
	float result = scale  * cos(float((2 * Constants::PI * v) / float(n)) + rotation);

	return result;
}

float PoligonScreenPosition::calculateY(int v) {
	float result = scale * sin(float((2 * Constants::PI * v) / float(n)) + rotation);

	return result;

}

float PoligonScreenPosition::getVerticeOneX() {
	return calculateX(0);
}

float PoligonScreenPosition::getVerticeOneY() {
	return calculateY(0);
}

float PoligonScreenPosition::getVerticeTwoX() {
	return calculateX(1);
}

float PoligonScreenPosition::getVerticeTwoY() {
	return calculateY(1);
}

float PoligonScreenPosition::getVerticeThreeX() {
	return calculateX(2);
}

float PoligonScreenPosition::getVerticeThreeY() {
	return calculateY(2);
}

float PoligonScreenPosition::getVerticeFourX() {
	return calculateX(3);
}

float PoligonScreenPosition::getVerticeFourY() {
	return calculateY(3);
}

float PoligonScreenPosition::getVerticeFiveX() {
	return calculateX(4);
}

float PoligonScreenPosition::getVerticeFiveY() {
	return calculateY(4);
}

float PoligonScreenPosition::getVerticeSixX() {
	return calculateX(5);
}

float PoligonScreenPosition::getVerticeSixY() {
	return calculateY(5);
}

PoligonScreenPosition::~PoligonScreenPosition()
{
}
